package com.xmy.cultivate.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xmy.cultivate.entity.EnrollInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xmy.cultivate.entity.views.EnrollDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 招生数据 Mapper 接口
 * </p>
 *
 * @author min
 * @since 2023-02-10
 */
public interface EnrollInfoMapper extends BaseMapper<EnrollInfo> {


    @Select("select * from enroll_info ${ew.customSqlSegment}")
    public abstract IPage<EnrollDetail> getParticulars(IPage<?> page, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select * from (select t1.*,t2.year_part,t2.quarter_num from enroll_info as t1 LEFT JOIN order_apply as t2 on t1.order_id = t2.id and t1.deleted=0 and t2.status<>2) as t ${ew.customSqlSegment}")
    public abstract List<EnrollInfo> getEnrollInfoList(@Param(Constants.WRAPPER) Wrapper wrapper);
}
